package com.goods.business.converter;

import com.goods.common.model.business.ProductCategory;
import com.goods.common.vo.business.ProductCategoryTreeNodeVO;
import com.goods.common.vo.business.ProductCategoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

//转换Vo对象
@Component
public class productConverter {


    /**
     *  productCategory  转换  ProductCategoryVO
     * @param productCategory
     * @return
     */
    public static ProductCategoryVO ProductCategoryToVO(ProductCategory productCategory){
        //判断
        if (productCategory != null){

            //赋值
            ProductCategoryVO productCategoryVO = new ProductCategoryVO();

            BeanUtils.copyProperties(productCategory,productCategoryVO);
            return productCategoryVO;
        }
        return null;
    }

    /**
     *  productCategory  转换  ProductCategoryVO
     * @param productCategory
     * @return
     */
    public static ProductCategoryTreeNodeVO ToProductCategoryTreeNodeVO(ProductCategory productCategory){
        //判断
        if (productCategory != null){

            //赋值
            ProductCategoryTreeNodeVO productCategoryVO = new ProductCategoryTreeNodeVO();

            BeanUtils.copyProperties(productCategory,productCategoryVO);
            return productCategoryVO;
        }
        return null;
    }

}
